package com.heima.wemedia.controller.v1;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author brianxia
 * @version 1.0
 * @date 2022-11-13 9:50
 */
@RestController
@RequestMapping("/api/v1/channel")
public class ChannelsController {

    @Autowired
    private ChannelService channelService;

    @GetMapping("/channels")
    public ResponseResult channels(){
        return ResponseResult.okResult(channelService.list(Wrappers.<WmChannel>lambdaQuery().
                orderByAsc(WmChannel::getOrd)));
    }
}
